package com.hgz.ssmdemo.common;

import org.springframework.http.HttpStatus;


public class BaseController {

    public <T> ResultVO<T> success(T data) {
        ResultVO<T> vo = new ResultVO<>();
        vo.setCode(HttpStatus.OK.value());
        vo.setData(data);
        return vo;
    }

    public <T> ResultVO<T> success() {
        ResultVO<T> vo = new ResultVO<>();
        vo.setCode(HttpStatus.OK.value());
        return vo;
    }

    public <T> ResultVO<T> error(int code, String message) {
        ResultVO<T> vo = new ResultVO<>();
        vo.setCode(code);
        vo.setMessage(message);
        return vo;
    }

    public <T> ResultVO<T> error(int code) {
        ResultVO<T> vo = new ResultVO<>();
        vo.setCode(code);
        return vo;
    }
}